package com.acwing.partition2;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/3/3 21:44
 */
public class AC112雷达设备 {

    private static final int N = 1010;
    private static double[][] intervals = new double[N][2];
    private static int n;
    private static double m;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        m = Integer.parseInt(ss[1]);
        boolean flag = true;
        for (int i = 0; i < n; i++) {
            ss = reader.readLine().split(" ");
            double x = Double.parseDouble(ss[0]), y = Double.parseDouble(ss[1]);
            if (y > m) {
                flag = false;
                break;
            }
            double len = Math.sqrt(m * m - y * y);
            intervals[i] = new double[]{x - len, x + len};
        }
        if (flag) {
            //按照右端点进行排序
            Arrays.sort(intervals, 0, n, (o1, o2) -> Double.compare(o1[1], o2[1]));
            int ans = 0;
            double last = -0x3f3f3f3f;
            for (int i = 0; i < n; i++) {
                if (last + 1e-5 < intervals[i][0]) {
                    ans++;
                    last = intervals[i][1];
                }
            }
            writer.write(ans + "\n");
        } else writer.write("-1\n");
        writer.flush();
    }
}
